package com.hengmei.smallscreen.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.hengmei.smallscreen.db.entity.HistoricalRecord

@Dao
interface HistoryDao {

    @Query("SELECT * FROM historicalrecord")
    suspend fun getAll(): List<HistoricalRecord>

    @Query("SELECT *FROM historicalrecord WHERE id LIKE:ids")
    suspend fun findById(ids: Int): HistoricalRecord?

    @Update
    suspend fun updateHistory(data: HistoricalRecord)
//    添加一条
    @Insert
    suspend fun insertHistory(data: HistoricalRecord)
//    删除一条
    @Delete
    suspend fun deleteHistory(data: HistoricalRecord)

}